<!-- Brand Logo -->
<a data-url="pages/Admin/index/index.html" class="brand-link">
    <img data-url="dist/img/AdminLTELogo.png" alt="AdminLTE Logo" class="brand-image img-circle elevation-3"
        style="opacity: .8" id="logo">
    <span class="brand-text font-weight-light">计算机维护队</span>
</a>

<!-- Sidebar -->
<div class="sidebar">
    <!-- Sidebar Menu -->
    <div class="user-panel mt-3 pb-3 mb-3 d-flex">
        <div class="image">
            <img data-url="dist/img/user2-160x160.jpg" class="img-circle elevation-2" alt="User Image" id="profile">
        </div>
        <div class="info">
            <a  class="d-block">百度WF</a>
        </div>
    </div>
    <nav class="mt-2">
        <ul class="nav nav-pills nav-sidebar flex-column nav-child-indent" data-widget="treeview" role="menu"
            data-accordion="false">
            <!-- Add icons to the links using the .nav-icon class
            with font-awesome or any other icon font library -->
            <li class="nav-item has-treeview">
                <a data-url="" onclick="return false" class="nav-link" id="personalCenter">
                    <i class="nav-icon fas fa-user"></i>
                    <p>
                        个人中心
                        <i class="right fas fa-angle-left"></i>
                    </p>
                </a>
                <ul class="nav nav-treeview">
                    <!-- <li class="nav-item">
            <a href="#" class="nav-link active">
            <i class="far fa-circle nav-icon"></i>
            <p>Active Page</p>
            </a>
        </li> -->
                    <li class="nav-item">
                        <a data-url="pages/Admin/personalCenter/myInfo.html" class="nav-link" id="myInfo">
                            <i class="far fa-circle nav-icon"></i>
                            <p>个人信息</p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a data-url="pages/Admin/personalCenter/myWork.html" class="nav-link" id="myWork">
                            <i class="far fa-circle nav-icon"></i>
                            <p>我的任务</p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a data-url="pages/Admin/personalCenter/changePassword.html" class="nav-link" id="changePassword">
                            <i class="far fa-circle nav-icon"></i>
                            <p>修改密码</p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a data-url="pages/Admin/personalCenter/unreturnedItems.html" class="nav-link" id="unreturnedItems">
                            <i class="far fa-circle nav-icon"></i>
                            <p>待归还物资</p>
                        </a>
                    </li>
                </ul>
            </li>

            <li class="nav-item has-treeview" >
                <a data-url="" onclick="return false" class="nav-link" id="materials">
                    <i class="nav-icon fas fa-boxes"></i>
                    <p>
                        图书资源
                        <i class="right fas fa-angle-left"></i>
                    </p>
                </a>
                <ul class="nav nav-treeview">
                    <!-- <li class="nav-item">
                        <a data-url="pages/Admin/materials/materialsBorrowing.html" class="nav-link" id="materialsBorrowing">
                            <i class="far fa-circle nav-icon"></i>
                            <p>物资借用</p>
                        </a>
                    </li> -->
                    <li class="nav-item">
                        <a data-url="pages/Admin/materials/materialsList.html" class="nav-link" id="materialsList">
                            <i class="far fa-circle nav-icon"></i>
                            <p>物资列表</p>
                        </a>
                    </li>
                    <!-- <li class="nav-item">
                        <a data-url="pages/Admin/materials/booksBorrowing.html" class="nav-link" id="booksBorrowing">
                            <i class="far fa-circle nav-icon"></i>
                            <p>图书借还</p>
                        </a>
                    </li> -->
                    <li class="nav-item">
                        <a data-url="pages/Admin/materials/materialsBorrowHistory.html" id="materialsBorrowHistory" class="nav-link">
                            <i class="far fa-circle nav-icon"></i>
                            <p>物资借用历史</p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a data-url="pages/Admin/materials/booksBorrowHistory.html" id="booksBorrowHistory" class="nav-link">
                            <i class="far fa-circle nav-icon"></i>
                            <p>图书借用历史</p>
                        </a>
                    </li>
                </ul>
            </li>

            <li class="nav-item has-treeview">
                <a data-url="" onclick="return false" class="nav-link" id="taskCenter">
                    <i class="nav-icon fas fa-paperclip"></i>
                    <p>
                        任务中心
                        <i class="right fas fa-angle-left"></i>
                    </p>
                </a>
                <ul class="nav nav-treeview">
                    <li class="nav-item">
                        <a data-url="pages/Admin/taskCenter/onlineTask.html" class="nav-link" id="onlineTask">
                            <i class="far fa-circle nav-icon"></i>
                            <p>线上任务</p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a data-url="pages/Admin/taskCenter/toBeReleased.html" class="nav-link" id="toBeReleased">
                            <i class="far fa-circle nav-icon"></i>
                            <p>待发布</p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a data-url="pages/Admin/taskCenter/toBeDone.html" class="nav-link" id="toBeDone">
                            <i class="far fa-circle nav-icon"></i>
                            <p>待完成</p>
                        </a>
                    </li>
                    

                </ul>
            </li>
            <li class="nav-item has-treeview">
                <a data-url="" onclick="return false" class="nav-link" id="member">

                    <i class="nav-icon fas fa-user-friends"></i>
                    <p>
                        成员管理
                        <i class="right fas fa-angle-left"></i>
                    </p>
                </a>
                <ul class="nav nav-treeview">
                    <li class="nav-item">
                        <a data-url="pages/Admin/member/memberList.html" id="memberList" class="nav-link">
                            <i class="far fa-circle nav-icon"></i>
                            <p>队员管理</p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a data-url="pages/Admin/member/operatorList.html" id="operatorList" class="nav-link">
                            <i class="far fa-circle nav-icon"></i>
                            <p>接线员管理</p>
                        </a>
                    </li>
                </ul>
            </li>
        </ul>
    </nav>
    <!-- /.sidebar-menu -->
</div>
<!-- /.sidebar -->
<script>
    function getContextPath() {
        var curWwwPath = document.location.href;
        var pathName = document.location.pathname;     
        var pos = curWwwPath.indexOf(pathName);
        var localhostPath = curWwwPath.substring(0,pos);
        return localhostPath;
        // return "C:\\Users\\zhuoQiang\\Desktop\\web\\proj"
    }

    function getChildID(){
        var name = document.location.pathname.split("/").pop()
        return name.split(".")[0]
    }
    function getParentID(){
        return document.location.pathname.split("/")[document.location.pathname.split("/").length-2]
    }
    $("#"+getParentID()).addClass("active").parent().addClass("menu-open")
    $("#"+getChildID()).addClass("active")
    $(".brand-link").attr("href", getContextPath() + "\/"+ $(".brand-link").data("url"))
    $("#logo").attr("src", getContextPath() + "\/"+ $("#logo").data("url"))
    $("#profile").attr("src", getContextPath() + "\/"+ $("#profile").data("url"))
    $(".nav-link").each(function(){
        $(this).attr("href", getContextPath() + "\/"+  $(this).data("url"))
    })
</script>